package org.example.struct.array;

/**
 * @author liyishan
 * @date 2024/4/25 10:12
 * @apiNote
 */

public class Test02739DistanceTraveled {
    public static void main(String[] args) {
        int mainTank = 1;
        int additionalTank = 2;
        System.out.println(distanceTraveled(mainTank, additionalTank));
    }

    public static int distanceTraveled(int mainTank, int additionalTank) {
        int ans = 0;
        for(int i = mainTank; i>0 ;i-=5){
            if(i >= 5){
                ans += 50;
                if(additionalTank >0){
                    i++;
                    additionalTank--;
                }
            }else{
                ans += i *10;
            }
        }
        return ans;
    }

    public int distanceTraveled1(int mainTank, int additionalTank) {
        return 10 * (mainTank + Math.min((mainTank - 1) / 4, additionalTank));
    }
}
